package com.matrix;

import lombok.Data;

@Data
public class Dependency {

    private String groupId;

    private String artifactId;

    private String type;

    private String version;

    private String scope;

    public static Dependency fromString(String desc) {
        desc = Common.replaceBlank(desc);
        String[] array = desc.split(":");
        if (array.length != 5) {
            return null;
        }
        Dependency dependency = new Dependency();
        dependency.groupId = array[0];
        dependency.artifactId = array[1];
        dependency.type = array[2];
        dependency.version = array[3];
        dependency.scope = array[4];
        return dependency;
    }

}
